home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / CC_C / H001C.ZIP / DJGPP3.ZIP / INCLUDE / TZFILE.H < prev    next >
C/C++ Source or Header  |  1990-12-30  |  4KB  |  134 lines

  1. /*
  2.  * Copyright (c) 1988 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * This code is derived from software contributed to Berkeley by
  6.  * Arthur David Olson of the National Cancer Institute.
  7.  *
  8.  * Redistribution and use in source and binary forms are permitted provided
  9.  * that: (1) source distributions retain this entire copyright notice and
  10.  * comment, and (2) distributions including binaries display the following
  11.  * acknowledgement:  ``This product includes software developed by the
  12.  * University of California, Berkeley and its contributors'' in the
  13.  * documentation or other materials provided with the distribution and in
  14.  * all advertising materials mentioning features or use of this software.
  15.  * Neither the name of the University nor the names of its contributors may
  16.  * be used to endorse or promote products derived from this software without
  17.  * specific prior written permission.
  18.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  19.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  20.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21.  *
  22.  *    @(#)tzfile.h    5.9 (Berkeley) 6/11/90
  23.  */
  24.  
  25. /*
  26. ** Information about time zone files.
  27. */
  28.  
  29.             /* Time zone object file directory */
  30. #define TZDIR        "/usr/share/zoneinfo"
  31. #define TZDEFAULT    "/etc/localtime"
  32. #define TZDEFRULES    "posixrules"
  33.  
  34. /*
  35. ** Each file begins with. . .
  36. */
  37.  
  38. struct tzhead {
  39.     char    tzh_reserved[24];    /* reserved for future use */
  40.     char    tzh_ttisstdcnt[4];    /* coded number of trans. time flags */
  41.     char    tzh_leapcnt[4];        /* coded number of leap seconds */
  42.     char    tzh_timecnt[4];        /* coded number of transition times */
  43.     char    tzh_typecnt[4];        /* coded number of local time types */
  44.     char    tzh_charcnt[4];        /* coded number of abbr. chars */
  45. };
  46.  
  47. /*
  48. ** . . .followed by. . .
  49. **
  50. **    tzh_timecnt (char [4])s        coded transition times a la time(2)
  51. **    tzh_timecnt (unsigned char)s    types of local time starting at above
  52. **    tzh_typecnt repetitions of
  53. **        one (char [4])        coded GMT offset in seconds
  54. **        one (unsigned char)    used to set tm_isdst
  55. **        one (unsigned char)    that's an abbreviation list index
  56. **    tzh_charcnt (char)s        '\0'-terminated zone abbreviations
  57. **    tzh_leapcnt repetitions of
  58. **        one (char [4])        coded leap second transition times
  59. **        one (char [4])        total correction after above
  60. **    tzh_ttisstdcnt (char)s        indexed by type; if TRUE, transition
  61. **                    time is standard time, if FALSE,
  62. **                    transition time is wall clock time
  63. **                    if absent, transition times are
  64. **                    assumed to be wall clock time
  65. */
  66.  
  67. /*
  68. ** In the current implementation, "tzset()" refuses to deal with files that
  69. ** exceed any of the limits below.
  70. */
  71.  
  72. /*
  73. ** The TZ_MAX_TIMES value below is enough to handle a bit more than a
  74. ** year's worth of solar time (corrected daily to the nearest second) or
  75. ** 138 years of Pacific Presidential Election time
  76. ** (where there are three time zone transitions every fourth year).
  77. */
  78. #define TZ_MAX_TIMES    370
  79.  
  80. #define NOSOLAR            /* 4BSD doesn't currently handle solar time */
  81.  
  82. #ifndef NOSOLAR
  83. #define TZ_MAX_TYPES    256    /* Limited by what (unsigned char)'s can hold */
  84. #else
  85. #define TZ_MAX_TYPES    10    /* Maximum number of local time types */
  86. #endif
  87.  
  88. #define TZ_MAX_CHARS    50    /* Maximum number of abbreviation characters */
  89.  
  90. #define    TZ_MAX_LEAPS    50    /* Maximum number of leap second corrections */
  91.  
  92. #define SECSPERMIN    60
  93. #define MINSPERHOUR    60
  94. #define HOURSPERDAY    24
  95. #define DAYSPERWEEK    7
  96. #define DAYSPERNYEAR    365
  97. #define DAYSPERLYEAR    366
  98. #define SECSPERHOUR    (SECSPERMIN * MINSPERHOUR)
  99. #define SECSPERDAY    ((long) SECSPERHOUR * HOURSPERDAY)
  100. #define MONSPERYEAR    12
  101.  
  102. #define TM_SUNDAY    0
  103. #define TM_MONDAY    1
  104. #define TM_TUESDAY    2
  105. #define TM_WEDNESDAY    3
  106. #define TM_THURSDAY    4
  107. #define TM_FRIDAY    5
  108. #define TM_SATURDAY    6
  109.  
  110. #define TM_JANUARY    0
  111. #define TM_FEBRUARY    1
  112. #define TM_MARCH    2
  113. #define TM_APRIL    3
  114. #define TM_MAY        4
  115. #define TM_JUNE        5
  116. #define TM_JULY        6
  117. #define TM_AUGUST    7
  118. #define TM_SEPTEMBER    8
  119. #define TM_OCTOBER    9
  120. #define TM_NOVEMBER    10
  121. #define TM_DECEMBER    11
  122.  
  123. #define TM_YEAR_BASE    1900
  124.  
  125. #define EPOCH_YEAR    1970
  126. #define EPOCH_WDAY    TM_THURSDAY
  127.  
  128. /*
  129. ** Accurate only for the past couple of centuries;
  130. ** that will probably do.
  131. */
  132.  
  133. #define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)
  134.